//
//  CharacterInfo.m
//  TowerDefence
//
//  Created by User on 6/27/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import "CharacterInfoPopup.h"

@implementation CharacterInfoPopup

-(id)initCharacterInfoPopupWith:(GameLayer *)_gameLayer {
    self = [super initPopupWith:_gameLayer];
        
    [self drawPopup];
    
    return self;
}

-(void)drawPopup {
    mainSprite = [[CCSprite alloc]initWithFile:IMAGE_POPUP_BACKGROUND];
    
    CCSprite *popupHeader = [CCSprite spriteWithFile:IMAGE_POPUP_HEADER_BACKGROUND];
    popupHeader.position = ccp(mainSprite.contentSize.width/2, mainSprite.contentSize.height);
    [mainSprite addChild:popupHeader];
    
    //header title
    CCLabelTTF *headerTitle = [CCLabelTTF labelWithString:@"GOBLIN" fontName:FONT_COMIC_BOOK fontSize:22];
    headerTitle.position = ccp(popupHeader.contentSize.width/2,popupHeader.contentSize.height/2 + 5);
    headerTitle.color = ccc3(0, 0, 0);
    [popupHeader addChild:headerTitle];
    
    //Map Thumbnail
    CCSprite *characterThumb = [CCSprite spriteWithFile:THUMBNAIL_GOBLIN];
    characterThumb.position = ccp(20 + characterThumb.contentSize.width/2, mainSprite.contentSize.height/2);
    [mainSprite addChild:characterThumb];
    
    //Map detail
    CCLabelTTF *charDetail = [CCLabelTTF labelWithString:@"draw map detail string at here!!!" dimensions:CGSizeMake(220, characterThumb.contentSize.height) alignment:UITextAlignmentLeft fontName:FONT_MARKER_FELT fontSize:14];
    charDetail.color = ccc3(45, 45, 45);
    charDetail.anchorPoint = ccp(0, 1);
    charDetail.position = ccp(characterThumb.position.x + characterThumb.contentSize.width/2 + 10, characterThumb.position.y + characterThumb.contentSize.height/2);
    [mainSprite addChild:charDetail];
    
    //Draw information 
    
    CCMenuItemImage *okButton = [CCMenuItemImage itemFromNormalImage:IMAGE_POPUP_GREEN_BUTTON_BACKGROUND selectedImage:IMAGE_POPUP_GREEN_BUTTON_SELECTED target:self selector:@selector(okButtonClick)];
    CCLabelTTF *okButtonLabel = [CCLabelTTF labelWithString:@"OK" fontName:FONT_COMIC_BOOK fontSize:26];
    okButtonLabel.color = ccc3(255, 255, 64);
    okButtonLabel.position = ccp(okButton.contentSize.width/2,okButton.contentSize.height/2);
    [okButton addChild:okButtonLabel];
    
    CCMenu *buttonMenu = [CCMenu menuWithItems:okButton, nil];
    [buttonMenu alignItemsHorizontallyWithPadding:40.0f];
    buttonMenu.position = ccp(mainSprite.contentSize.width/2, 20 - okButton.contentSize.height/2);
    [mainSprite addChild:buttonMenu];
}

@end
